package com.example.demo;

import com.example.demo.user.User;
import com.example.demo.userDTO.UserDTO;
import org.springframework.beans.BeanUtils;

public class Main {
    public static void main(String[] args) {
        User user = new User();
        user.setAge(20);
        user.setName("John");
        user.setId(1L);
        System.out.println("这是user:"+user);
        UserDTO userDTO = new UserDTO();
        try{
            BeanUtils.copyProperties(user, userDTO);
            System.out.println("这里是userDTO:"+userDTO);
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}
